package be.beeworks.moneypile.model;

import java.io.Serializable;

import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Version;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlID;
import javax.xml.bind.annotation.XmlIDREF;

import org.hibernate.search.annotations.DocumentId;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.Index;
import org.hibernate.search.annotations.Store;

public class Timesheet implements Serializable {
	private static final long serialVersionUID = 7892490606582898680L;
	@Version
    private Long version;
    @Id
    @XmlID
    @DocumentId
    @Min(32)
    @Max(32)
    private String id;
    @NotNull
    @Size(min = 1, max = 100)
    @Field(index = Index.TOKENIZED, store = Store.NO)
    private String name;
    @NotNull
    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "project_id_ref", nullable = false)
    @XmlIDREF
    private Project project;
	public Long getVersion() {
		return version;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public Project getProject() {
		return project;
	}
	public void setProject(Project project) {
		this.project = project;
	}
	public String getId() {
		return id;
	}

}
